[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
A_INS()
Insert an element into an array
-------------------------------------------------------------------------------
Syntax
A_INS( <aTarget>, [<idxPos>], [<nCount>] )
Arguments
<aTarget> is the array into which an element will be inserted.
<idxPos> is the position in the target array of the element to be
inserted.
<nCount> is the number of elements to shift. The default is all
elements starting at <idxPos> until the end of the array.
Returns
None.
Description
A_INS() is similar to Clipper's AINS() function. All elements from
<idxPos> for <nCount> will be shifted down one element. The last
element in <nCount> will be pushed into oblivion. A blank element
is inserted at the position created by the shift and filled with
the default value based on the type of the array (see
A_DECLARE()).
FlexFile's multi-dimensional arrays are not nested single
dimensional arrays. Therefore, A_INS()erting an element has no
other affect than shifting <nCount> elements down one position.
Wrapping will occur if <nCount> goes beyond the current row
pointed to by <idxPos>. For example, if you have a two dimensional
array with accounts in the first dimension and 12 prior period
amounts in the second dimension, and you wanted to operate on the
first quarter (i.e. 3 periods), making <nCount> three times the
number of accounts will "wrap" around three periods. See the
discussion on arrays in chapter 2 for more information on this
feature.
Examples
// Declare a two dimensional (C)haracter array
LOCAL rows, cols, x, y, z
rows = 10
cols = 20
z = 1
aChar = A_DECLARE( "C", rows, cols )
// Fill the array with increasing character values.
FOR x = 1 to rows
FOR y = 1 to cols
z++
A_STORE( aChar, chr(z), A_( x, y ) )
NEXT
NEXT
// Insert four blank elements (chr(0)'s) at the first element
// and shift all elements from the second element to the
// end of the array down four positions. Wrapping will occur.
A_INS( aChar, A_(1, 1), 4 )
See Also:
A_DECLARE()
A_DEL()
A_SCROLL()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson